#/bin/bash
currentcpuload=`uptime | awk -F"load average:" '{print $NF}'|awk -F" " '{print $1}'|awk -F"." '{print $1}'`
if [ $currentcpuload -ge 100 ];then
    exit 
fi
script=$(cd `dirname $0`; pwd)"/"$(basename $0)
#runnum=`ps aux | grep $script | wc -l`
#if [ $runnum -gt 3 ];then
#exit
#fi
minutedate=$(date -d"`date +"%Y-%m-%d %H:%M"`" +%s)
dirpath="/dev/shm/omat/cvmfsclientinfo/"
if [ ! -d $dirpath ]; then
    mkdir -p $dirpath
fi
cvmfs_config stat |grep http > $dirpath"cvmfsmountinfo_"$minutedate".data"
cvmfs_talk cleanup rate 10 | grep -A 1 common.ihep.ac.cn |grep -v common.ihep.ac.cn > $dirpath"cvmfscleaninfo_"$minutedate".data"
find $dirpath -cmin +1200 -name "cvmfs*"  -exec /bin/rm -rf {} \;
